$(function(){
    var myData = window.location.search;
    var sendData = myData.goodsID;

    MyJson("http://datainfo.duapp.com/shopdata/getGoods.php","get",sendData,"JSONP",successFnHot,errorFnHot);
    function successFnHot(data){

        layer.close(ci);
        $("#row").empty();
        $.each(data,function(i,v){
            if(data){
                var oldPrice ;
                if(v.discount!=0){
                    oldPrice=v.price/(v.discount *0.1);
                    oldPrice = oldPrice.toFixed(2);
                }else{
                    oldPrice= v.price;
                }
                var str = "<div class='col-xs-6 col-md-3'><div class='thumbnail'><img src='"+ v.goodsListImg+"' alt='...'/><h3 class='text-center'>"+ v.goodsName+"</h3><p>价格：<b class='text-danger'>"+ v.price+"</b><s>"+oldPrice+"</s><b class='pull-right'>"+ v.discount+"折</b></p><p class='text-center'><a class='btn btn-primary' role='button' href='pro_details.html'>立即购买</a><a class='btn btn-default' role='button' href='#'>加入购物车</a></p></div></div>";
                $("#row").append(str);

            }else{
                layer.msg("没的数据！")
            }
        });
    }

    function errorFnHot (error){
        layer.msg("数据请求出错"+error)
    }


});